package com.lehe.util;

import com.lehe.common.utils.StringUtil;
import com.lehe.entry.AdminMenuDto;

import java.util.List;

/**
 * jstl自定义标签
 *
 * @author 王丹
 * @since 2017-07-11
 */
public class TagUtil {

    private static List<AdminMenuDto> menuDtoList;

    public static boolean hasButtonRole(String buttonKey){
        return menuDtoList.stream().anyMatch(dto -> StringUtil.isNotBlank(dto.getUrl()) && dto.getUrl().indexOf(buttonKey)>=0);
    }

    public static List<AdminMenuDto> getMenuDtoList() {
        return menuDtoList;
    }

    public static void setMenuDtoList(List<AdminMenuDto> menuDtoList) {
        TagUtil.menuDtoList = menuDtoList;
    }
}
